#include "Watch_View.h"

LV_IMG_DECLARE(watch_bg);
LV_IMG_DECLARE(hour);
LV_IMG_DECLARE(minute);
LV_IMG_DECLARE(second);

// static lv_timer_t *timer1;
WatchView::WatchView() {
}

WatchView::~WatchView() {
}

void WatchView::create()
{   ui.root = lv_obj_create(NULL);
    lv_obj_t *bg = lv_img_create(ui.root);
    lv_img_set_src(bg, &watch_bg);
    lv_img_set_zoom(bg, 310);
    lv_obj_center(bg);
    ui.bg = bg;

    lv_obj_t *img_hour = lv_img_create(bg);
    lv_img_set_src(img_hour, &hour);
    lv_obj_set_align(img_hour, LV_ALIGN_CENTER);
    lv_img_set_zoom(img_hour, 310);
    lv_img_set_antialias(img_hour, true);
    ui.img_hour = img_hour;

    lv_obj_t *img_minute = lv_img_create(bg);
    lv_img_set_src(img_minute, &minute);
    lv_img_set_zoom(img_minute, 310);
    lv_obj_set_align(img_minute, LV_ALIGN_CENTER);
    ui.img_minute = img_minute;
    // lv_img_set_antialias(img_minute,true);

    lv_obj_t *img_second = lv_img_create(bg);
    lv_img_set_src(img_second, &second);
    lv_img_set_zoom(img_second, 310);
    lv_obj_set_align(img_second, LV_ALIGN_CENTER);
    ui.img_second = img_second;

}



void WatchView::load() {
    // lv_disp_load_scr(ui.root);
    lv_scr_load_anim(ui.root, lv_scr_load_anim_t(rand()&15)/*LV_SCR_LOAD_ANIM_FADE_IN*/, 300, 0, false);
}
